package BehavioralPattern.Command.Extend;

/**
 * 需求：须要redo undo
 * 解决：加入备忘录模式,一个简单的实现如下
 * 
 * @author Xinz
 *
 */
public class ConcreteCommandOne implements Command {
	
	private Receiver receiver;
	private Receiver lastReceiver;
	
	public ConcreteCommandOne(Receiver receiver) {
		this.receiver = receiver;
	}
	
	@Override
	public void execute() {
		record();
		receiver.actionOne();
	}
	
	public void undo() {
		// 恢复状态
	}
	
	public void redo() {
		lastReceiver.actionOne();
	}
	
	public void record() {
		// 记录状态
	}
	
	@Override
	public String getName() {
		return this.getName();
	}

}
